using System;
using System.Collections.Generic;
using System.ComponentModel;

using Sinacor.Servico.Bovespa.Cliente.Service.DataContract.Response;
using Sinacor.Servico.Bovespa.Cliente.BusinessEntity;

namespace Sinacor.Servico.Bovespa.Cliente.Service.ServiceImplementation.Translator
{
    public static class TranslateBetweenContaCorrenteResponseAndContaCorrente
    {
        public static DataContract.Response.ContaCorrenteResponse TranslateContaCorrenteToContaCorrenteResponse(BusinessEntity.ContaCorrente from)
        {

            if (from == null) return null;

            DataContract.Response.ContaCorrenteResponse to = new DataContract.Response.ContaCorrenteResponse();
            to.Disponivel = from.Disponivel;
            to.Projetado = from.Projetado;
            to.NegociosDia = from.NegociosDia;
            to.isContaInvestimento = from.isContaInvestimento;
            return to;
        }

        public static BusinessEntity.ContaCorrente TranslateContaCorrenteResponseToContaCorrente(DataContract.Response.ContaCorrenteResponse from)
        {
            
            if (from == null) return null;

            BusinessEntity.ContaCorrente to = new BusinessEntity.ContaCorrente();
            to.Disponivel = from.Disponivel;
            to.Projetado = from.Projetado;
            to.NegociosDia = from.NegociosDia;
            to.isContaInvestimento = from.isContaInvestimento;
            return to;
        }
        
        public static List<DataContract.Response.ContaCorrenteResponse> TranslateContaCorrenteListToContaCorrenteResponseList(List<BusinessEntity.ContaCorrente> from)
        {

            if (from == null) return null;
            List<DataContract.Response.ContaCorrenteResponse> to = new List<ContaCorrenteResponse>();
            foreach (BusinessEntity.ContaCorrente fromItem in from)
            {
                to.Add(TranslateContaCorrenteToContaCorrenteResponse(fromItem));
            }
            return to;

        }

        public static List<BusinessEntity.ContaCorrente> TranslateContaCorrenteResponseListToContaCorrenteList(List<DataContract.Response.ContaCorrenteResponse> from)
        {

            if (from == null) return null;

            List<BusinessEntity.ContaCorrente> to = new List<ContaCorrente>();
            foreach (DataContract.Response.ContaCorrenteResponse fromItem in from)
            {
                to.Add(TranslateContaCorrenteResponseToContaCorrente(fromItem));
            }
            return to;

        }
    }
}

